/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Ppal.java
 *
 * Created on 15/09/2012, 07:59:48 PM
 */

package Gui;

import ClassEntidad.Funcionario;
import ClassEntidad.Sistema;

/**
 *
 * @author borisgr04
 */
public class Ppal extends javax.swing.JFrame {

    public void inicializacion(){
        
        iniFormularios.mostrarUsuarioActual(usuarioActual);
        this.setResizable(false);
        this.setLocationRelativeTo(null);
        
        String Rol = Sistema.instancia().getUsuAct().getRol();
        
        OrganizarB.setEnabled(Rol.equals("ARCHIVISTA"));
        this.recepcionarB.setEnabled(Rol.equals("RECEPCIONISTA"));
        
        usuariosRoles.setEnabled(Rol.equals("ARCHIVISTA"));
        

    }
    /** Creates new form Ppal */
    public Ppal() {
        initComponents();
        inicializacion();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        trasladarB = new javax.swing.JButton();
        bandejaB = new javax.swing.JButton();
        nuevoDocJ = new javax.swing.JButton();
        nuevoDocEJ = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        recepcionarB = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        OrganizarB = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        usuariosRoles = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jButton8 = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        cerrarsesionB = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        usuarioActual = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SISTEMA DE GESTIÓN DOCUMENTAL");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Gestión "));

        trasladarB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/folder-move-icon.png"))); // NOI18N
        trasladarB.setText("Traslado a Archivo Central");
        trasladarB.setActionCommand("Traslado a Archivo");
        trasladarB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                trasladarBActionPerformed(evt);
            }
        });

        bandejaB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Actions-mail-receive-icon.png"))); // NOI18N
        bandejaB.setText("Bandeja de Documentos");
        bandejaB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bandejaBActionPerformed(evt);
            }
        });

        nuevoDocJ.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/file-new-icon.png"))); // NOI18N
        nuevoDocJ.setText("Nuevo Documento Externo");
        nuevoDocJ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nuevoDocJActionPerformed(evt);
            }
        });

        nuevoDocEJ.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/file-new-icon.png"))); // NOI18N
        nuevoDocEJ.setText("Nuevo Documento Interno");
        nuevoDocEJ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nuevoDocEJActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(trasladarB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(bandejaB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(nuevoDocJ, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(nuevoDocEJ, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(nuevoDocEJ, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(nuevoDocJ)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(bandejaB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(trasladarB)
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Recepción Documentos Externos"));

        recepcionarB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/email-receive-icon.png"))); // NOI18N
        recepcionarB.setText("Recepcionar");
        recepcionarB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                recepcionarBActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(recepcionarB, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(recepcionarB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Archivo Central"));

        OrganizarB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/2-Documents-icon.png"))); // NOI18N
        OrganizarB.setText("Organizar Documentos");
        OrganizarB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OrganizarBActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(OrganizarB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(OrganizarB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Administración"));

        usuariosRoles.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Administrative-Tools-icon.png"))); // NOI18N
        usuariosRoles.setText("Administrar Usuarios y Roles");
        usuariosRoles.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usuariosRolesActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(usuariosRoles, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(usuariosRoles)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Reportes"));

        jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/report-icon.png"))); // NOI18N
        jButton8.setText("Reportes ");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jButton8)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Sesión"));

        cerrarsesionB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Apps-session-quit-icon.png"))); // NOI18N
        cerrarsesionB.setText("Cerrar Sesión");
        cerrarsesionB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cerrarsesionBActionPerformed(evt);
            }
        });

        jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Apps-session-logout-icon.png"))); // NOI18N
        jButton10.setText("Salir de la Aplicación");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        jLabel1.setText("Login:");

        usuarioActual.setText("UsuarioActual");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(usuarioActual)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(cerrarsesionB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton10)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cerrarsesionB)
                    .addComponent(jButton10)
                    .addComponent(jLabel1)
                    .addComponent(usuarioActual))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void recepcionarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_recepcionarBActionPerformed
        // TODO add your handling code here:
        RecepcionarDocGUI r= new  RecepcionarDocGUI();
        r.setVisible(true);
        
        
    }//GEN-LAST:event_recepcionarBActionPerformed

    private void nuevoDocJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nuevoDocJActionPerformed
        // TODO add your handling code here:
       ProducirDocGUI pdg= new ProducirDocGUI();
       pdg.setVisible(true);
    }//GEN-LAST:event_nuevoDocJActionPerformed

    private void bandejaBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bandejaBActionPerformed
        // TODO add your handling code here:
        BandejaEntGUI beg=new  BandejaEntGUI();
        beg.setVisible(true);
    }//GEN-LAST:event_bandejaBActionPerformed

    private void cerrarsesionBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cerrarsesionBActionPerformed
        // TODO add your handling code here:
        LoginGUI l= new LoginGUI();
        l.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_cerrarsesionBActionPerformed

    private void nuevoDocEJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nuevoDocEJActionPerformed
        // TODO add your handling code here:
        ProducirDocIntGUI pdi=new ProducirDocIntGUI();
        pdi.setVisible(true);
    }//GEN-LAST:event_nuevoDocEJActionPerformed

    private void trasladarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_trasladarBActionPerformed
        // TODO add your handling code here:
        TranferirDocGUI tdg=new TranferirDocGUI();
        tdg.setVisible(true);
    }//GEN-LAST:event_trasladarBActionPerformed

    private void OrganizarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OrganizarBActionPerformed
        // TODO add your handling code here:
        OrganizarDocGUI odg= new OrganizarDocGUI();
        odg.setVisible(true);
    }//GEN-LAST:event_OrganizarBActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_jButton10ActionPerformed

    private void usuariosRolesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usuariosRolesActionPerformed
        // TODO add your handling code here:
        BuscarFunGUI bf = new BuscarFunGUI();
        bf.setVisible(true);
    }//GEN-LAST:event_usuariosRolesActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        // TODO add your handling code here:
        ReportesGUI rptGUI = new ReportesGUI();
        rptGUI.setVisible(true);
    }//GEN-LAST:event_jButton8ActionPerformed

    /**
    * @param args the command line argumeBandejaEntnts
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Ppal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton OrganizarB;
    private javax.swing.JButton bandejaB;
    private javax.swing.JButton cerrarsesionB;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton8;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JButton nuevoDocEJ;
    private javax.swing.JButton nuevoDocJ;
    private javax.swing.JButton recepcionarB;
    private javax.swing.JButton trasladarB;
    private javax.swing.JLabel usuarioActual;
    private javax.swing.JButton usuariosRoles;
    // End of variables declaration//GEN-END:variables

}
